/******************************************************************************
* @file lcd.h
* @author Zohar_Lee
* @version
* @date:2018.10.27
* @brief
******************************************************************************/
#ifndef __LCD_H__
#define __LCD_H__

#include "SWM181.h"

#define LCD_RST_GPIO GPIOD
#define LCD_RST_PIN PIN5
#define LCD_CD_GPIO GPIOA
#define LCD_CD_PIN PIN13
#define LCD_CS_GPIO GPIOA
#define LCD_CS_PIN PIN12
#define LCD_SCK_GPIO GPIOA
#define LCD_SCK_PIN PIN15
#define LCD_SDA_GPIO GPIOA
#define LCD_SDA_PIN PIN14
#define LCD_BK_GPIO GPIOD
#define LCD_BK_PIN PIN3

#define LcdRstPin_set() GPIO_SetBit(LCD_RST_GPIO, LCD_RST_PIN)
#define LcdRstPin_reset() GPIO_ClrBit(LCD_RST_GPIO, LCD_RST_PIN)
#define LcdCdPin_set() GPIO_SetBit(LCD_CD_GPIO, LCD_CD_PIN)
#define LcdCdPin_reset() GPIO_ClrBit(LCD_CD_GPIO, LCD_CD_PIN)
#define LcdCsPin_set() GPIO_SetBit(LCD_CS_GPIO, LCD_CS_PIN)
#define LcdCsPin_reset() GPIO_ClrBit(LCD_CS_GPIO, LCD_CS_PIN)
#define LcdSckPin_set() GPIO_SetBit(LCD_SCK_GPIO, LCD_SCK_PIN)
#define LcdSckPin_reset() GPIO_ClrBit(LCD_SCK_GPIO, LCD_SCK_PIN)
#define LcdSdaPin_set() GPIO_SetBit(LCD_SDA_GPIO, LCD_SDA_PIN)
#define LcdSdaPin_reset() GPIO_ClrBit(LCD_SDA_GPIO, LCD_SDA_PIN)

typedef enum
{
    eStatusStop,
    eStatusRun
} RunStatus_TypeDef;

typedef enum
{
    eStartModeNo,
    eStartModeMenual,
    eStartModeRF
} StartMode_TypeDef;

typedef enum
{
    eLoseOK,
    eLoseA,
    eLoseB,
    eLoseC
} LoseMode_TypeDef;

typedef enum
{
    eOverCurOK,
    eOverCurA,
    eOverCurB,
    eOverCurC
} OverCurrent_TypeDef;

typedef enum
{
    eLowCurOK,
    eLowCurA,
    eLowCurB,
    eLowCurC
} LowCurrent_TypeDef;

extern volatile RunStatus_TypeDef gxRunStatus;

void vLcdBkOn(void);
void vLcdBkOff(void);
void LcdInit(void);
void LcdClear(void);
void LcdDisplayTest(void);
void LcdDisFrame(void);
void LcdDisVolatage(uint32_t volatage, ...);
void LcdDisCurrent(uint32_t current);
void lcdDisCharNO(uint32_t pos);
void LcdDisInSetCurrentMode(uint8_t buf[6], uint32_t ulPos);
void LcdDisRunStatus(RunStatus_TypeDef gxRunStatus);
void LcdDisLoseMode(LoseMode_TypeDef xLoseMode);
void LcdDisOverCurrentMode(OverCurrent_TypeDef xOverCur);
void LcdDisLowCurrentMode(LowCurrent_TypeDef xLowCur);
void LcdDisStartMode(StartMode_TypeDef xStartMode);
void LcdDisNowStatus(void);
void LcdDisLogo(void);
void LcdDisCalibratVoltage(void);
void LcdDisCalibratCurrent(void);
void LcdDisSetting(void);
void LcdDisRFstudy(void);
void LcdDisTiming(uint32_t time);
void LcdDisInSetTimingMode(uint8_t buf[6], uint32_t ulPos);
void LcdDisRefresh(void);

#endif //__LCD_H__

/*****************************************************************************/
